#ifndef _GSESSION_H
#define _GSESSION_H

#include "objpool.h"
struct xaddr{
	short port;
	char ip[40];
};

struct msg_queue_node{
	//struct buffer *value;
	struct msg_queue_node *next;
};

struct msg_queue{
	struct msg_queue_node *read;
	struct msg_queue_node *write;

	struct msg_queue_node *handle;
};

extern int msg_queue_initial(struct msg_queue *queue,size_t length);

struct xsession{
	int fd;//for array
	struct xaddr addr;
/*	struct msg_queue queue;*/
};
struct xsessionFactory{
	struct obj_pool *pool;
	struct xsession **sessions;
};
extern struct xsessionFactory* xsessionFactory_build(size_t count);
extern int xsessionFactory_release(struct xsessionFactory *factory);
extern struct xsession* xsession_new(int fd,struct xsessionFactory *factory);
extern int xsession_del(struct xsessionFactory *factory,struct xsession *session);

#endif
